
import EssentialResUrls from "src/_T/Res/EssentialResUrls";
import ResLoad from "src/_T/Res/ResLoad";
import BuffBase from "../Manager/BuffBase";

//、攻击速度提升
export default class AttackSlowUp extends BuffBase {

    RemoveTime = 0;
    RemoveMaxTime = 5;
    DownSpeed = 0.5;
    MeshObj: Laya.Sprite3D;
    InitBuffBase() {
        // super.InitBuffBase();
    }
    BuffOccur() {

        // let Url = EssentialResUrls.PrefabURL(_PrefabPrefabName.Cube);
        // ResLoad.Load3D(Url, Laya.Handler.create(this, () => {
        //     let Mes = PropsGenerationManager.Instance.CreatorFixedItem(Url, Name, this.m_SoldiersBase.m_SceneSprite3d);
        //     this.MeshObj = Mes.getChildAt(0) as Laya.Sprite3D;
        //     this.m_SoldiersBase.m_SceneSprite3d.addChild(Mes);
        //     Mes.transform.localPosition = new Laya.Vector3(0, 0, 0);
        //     this.MeshObj.transform.localScaleY = 0.5;
        //     this.MeshObj.transform.localScale = new Laya.Vector3(0.2, 0.2, 0.2);
        // }));
    }
    RefreshBuff() {
        this.RemoveTime = 0;
    }
    //Buff每帧调用
    BuffOnTick() {
        // this.RemoveTime += (Laya.timer.delta / 1000);
        // if (this.RemoveTime >= this.RemoveMaxTime) {
        //     this.BuffRemoved();
        //     return;
        // }
        // let Dt = this.m_SoldiersBase.m_TempAttributeBase.m_Hitpoints / this.m_SoldiersBase.m_TempAttributeBase.m_MaxHitpoints;
        // if (Dt <= 0.5) {
        //     this.m_SoldiersBase.m_TempAttributeBase.m_HitSpeed = this.m_SoldiersBase.m_TempAttributeBase.m_HitSpeed * 2.5;
        // }
    }
    //Buff移除
    BuffRemoved() {
        if (this.MeshObj != null) {
            this.MeshObj.removeSelf();
            this.MeshObj.destroy();
        }
        this.MeshObj = null;
        super.BuffRemoved();
    }
    //受到伤害
    BuffBeHurt() {

    }
    //攻击时
    BuffOnHit() {

    }
    //被杀死时
    BuffBeforeKilled() {
        this.BuffRemoved();
    }
    //敌人死亡时
    BuffAfterKilled() {

    }

}